#ifndef  __MyLogger_H__
#define  __MyLogger_H__
#include <iostream>
#include <log4cpp/OstreamAppender.hh>
#include <log4cpp/PatternLayout.hh>
#include <log4cpp/Category.hh>
#include <cstdarg>
using namespace std;
using namespace log4cpp;

#define LOG_INFO(format, ...) wd::MyLogger::getInstance()->info(__FILE__,__LINE__,__FUNCTION__,format, ##__VA_ARGS__);
#define LOG_DEBUG(format, ...) wd::MyLogger::getInstance()->info(__FILE__,__LINE__,__FUNCTION__,format, ##__VA_ARGS__);
#define LOG_ERROR(format, ...) wd::MyLogger::getInstance()->info(__FILE__,__LINE__,__FUNCTION__,format, ##__VA_ARGS__);
#define LOG_WARN(format, ...) wd::MyLogger::getInstance()->info(__FILE__,__LINE__,__FUNCTION__,format, ##__VA_ARGS__);
namespace wd
{
class MyLogger
{
public:
    void warn(const char * file,int line,const char * func,const char *msg);
    void error(const char * file,int line,const char * func,const char *msg);
    void debug(const char * file,int line,const char * func,const char *msg);
    void info(const char * file,int line,const char * func,const char *format, ...);
    static MyLogger * getInstance();
    static void destory();
private:
    MyLogger();
    ~MyLogger();
    MyLogger(const MyLogger &)=delete;
    MyLogger & operator=(const MyLogger &)=delete;
    static MyLogger * _pInstance;
    log4cpp::Category *_category;
};
}






#endif

